﻿using Anmlz.Data;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace Anmlz.Web.App_Start
{
    using Anmlz.Data.Contracts;

    public static class DbInitializer
    {
        public static void Initialize(IDependencyResolver dependencyResolver)
        {
            var unitOfWork = dependencyResolver.GetService<IUnitOfWork>();
            if (unitOfWork.DbInitialized)
            {
                return;
            }
            var dbContext = dependencyResolver.GetService<AnmlzDbContext>();
            var initializer = dependencyResolver.GetService<AnmlzDatabaseInitializer>();
            initializer.Seed(dbContext);
        }
    }
}